<?php
	$vanbanden = new Vbdencanxulybs();
	if(isset($_POST['btnTim']))
	{
		$SoDen = mb_convert_case($_POST['MaVanBanDen'],MB_CASE_TITLE,"utf-8") ;
		$NgayDen = $_POST['SoDen'];
		$NgayDen = $_POST['NgayDen'];
		$TrichYeu = $_POST['TrichYeu'];
		$SovaKyHieu = $_POST['SovaKyHieu'];
		$NoiBanHanh = $_POST['NoiBanHanh'];
		$Vbdencanxuly->SoDen = $SoDen;
		$Vbdencanxuly->NgayDen = $NgayDen;
		$Vbdencanxuly->TrichYeu = $TrichYeu;
		$Vbdencanxuly->SovaKyHieu = $SovaKyHieu;
		$Vbdencanxuly->NoiBanHanh = $NoiBanHanh;
	}
	$danhsach = $Vbdencanxuly->GetList();
?>
<div id="NoiDung" style="position:relative" class="form">
  <h3  class="text-primary">DANH SÁCH VĂN BẢN CẦN XỬ LÝ</h3>
  <div style="position:absolute; left:820px; top:10px;"><a href="Vbdencanxuly-them"><span class="glyphicon glyphicon-plus-sign" style="font-size:18px"></span></a> <a href="#"  style="margin-left:10px"><span id="clickSearch" class="glyphicon glyphicon-search" style="font-size:18px"></span></a></div>
  <div style="margin-top:20px; display:none" id="search">
    <form  action="phongban" method="post" role="form" class="form-inline">
      <div class="form-group form-custom">
        <label  for="tenphong">Số Đến:</label>
        <input type="text" class="form-control" placeholder="số đến" name="SoDen" class="required" />
      </div>
	   <div class="form-group form-custom">
        <label  for="tenphong">Ngày Đến:</label>
        <input type="text" class="form-control" placeholder="ngày đến" name="NgayDen" class="required" />
      </div>
	  <div class="form-group form-custom">
        <label  for="tenphong">Trích Yếu:</label>
        <input type="text" class="form-control" placeholder="trích yếu" name="TrichYeu" class="required" />
      </div>
	  <div class="form-group form-custom">
        <label  for="tenphong">Số và Ký Hiệu:</label>
        <input type="text" class="form-control" placeholder="số và ký hiệu" name="SovaKyHieu" class="required" />
      </div>
      <div class="form-group form-custom">
        <label  for="mota">Nơi Ban Hành:</label>
        <input type="text" class="form-control" placeholder="nơi ban hành" name="NoiBanHanh" class="required" />
      </div>
      <input type="submit" value="Tìm" class="btn-md" name="btnTim" />
    </form>
  </div>
  <script>
 $("#clickSearch").click(function()
	{
		$("#search").toggle("fast");
})
  </script>
 <div style="margin-top:20px;">
    <table class="table table-hover table-bordered table-striped">
      <thead>
        <tr>
			<th style="text-align:center">Số đến</th>
			<th style="text-align:center">Ngày đến</th>
			<th style="text-align:center">Số và ký hiệu</th>
			<th style="text-align:center">Trích yếu</th>
			<th style="text-align:center">Nơi ban hành</th>
			<th style="text-align:center"> Sửa </th>
			<th style="text-align:center"> Xóa </th>
        </tr>
      </thead>
      <tbody>
<?php
		
	if(!is_null($danhsach[0]['MaVanBanDen']))
	{
		
				for($i = 0; $i < count($danhsach); $i++)
				{
					$stt=$i+1;
					echo "<tr>";
						echo "<td>{$danhsach[$i]['MaVanBanDen']}</td>";
						if(isset($_POST['SoDen']))
						echo "<td>".highlight($danhsach[$i]['SoDen'],$SoDen)."</td>";
						else
						echo "<td>{$danhsach[$i]['SoDen']}</td>";
						if(isset($_POST['NgayDen']))
						echo "<td>".highlight($danhsach[$i]['NgayDen'],$NgayDen)."</td>";
						else
						echo "<td>{$danhsach[$i]['NgayDen']}</td>";
						if(isset($_POST['SovaKyHieu']))
						echo "<td>".highlight($danhsach[$i]['SovaKyHieu'],$SovaKyHieu)."</td>";
						else
						echo "<td>{$danhsach[$i]['SovaKyHieu']}</td>";
						if(isset($_POST['TrichYeu']))
						echo "<td>".highlight($danhsach[$i]['TrichYeu'],$TrichYeu)."</td>";
						else
						echo "<td>{$danhsach[$i]['TrichYeu']}</td>";
						if(isset($_POST['NoiBanHanh']))
						echo "<td>".highlight($danhsach[$i]['NoiBanHanh'],$NoiBanHanh)."</td>";
						else
						echo "<td>{$danhsach[$i]['NoiBanHanh']}</td>";
						
						
						echo "<td align='center'><a href='Vbdencanxuly-sua_" . $danhsach[$i]['MaVanBanDen'] . "'><span class='glyphicon glyphicon-pencil'></span></a></td>";
						
						echo "<td align='center'><a href='Vbdencanxuly-xoa_" . $danhsach[$i]['MaVanBanDen'] . "' onclick='return confirm(\"Bạn có muốn xóa " . $danhsach[$i]['TenPhongBan'] . " không?\")'><span class='glyphicon glyphicon-trash'></span></a></td>";
					echo "</tr>";
				}
	}
?>
      </tbody>
    </table>
  </div>
</div>
